﻿using RabbitMQ.Client;
using System.Text;

namespace PublishSubscribePublisher
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var factory = new ConnectionFactory() { HostName = "localhost" };
            var connection = factory.CreateConnection();
            var channel = connection.CreateModel();
            channel.ExchangeDeclare(exchange: "logs", type: "fanout");
            //var queueName = channel.QueueDeclare().QueueName;
            //channel.QueueBind(queue: queueName, exchange: "logs", routingKey: "");
            const string message = "log_sqadsfasd";
            var body = Encoding.UTF8.GetBytes(message);
            channel.BasicPublish(exchange: "logs", routingKey: string.Empty, basicProperties: null, body: body);

            Console.WriteLine($"[x] Sent {message}");
            Console.ReadLine();
        }
    }
}